import { Button, Table, TableColumn, Popover, Tag } from 'element-ui'
import axios from 'axios'
import baseUrl from '@/baseUrl'
export default {
  name: 'mTodoTable',
  data () {
    return {
      btn: '',
      tableData: []
    }
  },
  created () {
    this.getDataList()
  },
  components: {
    ElButton: Button,
    ElTable: Table,
    ElTableColumn: TableColumn,
    ElPopover: Popover,
    ElTag: Tag
  },
  watch: {
    $route: 'getDataList'
  },
  methods: {
    handleEdit (index, row) {
      console.log(index, row)
    },
    handleDelete (index, row) {
      console.log(index, row)
    },
    getDataList () {
      this.btn = this.$route.params.title === 'db' ? '已办' : '未办'
      axios.get(`${baseUrl}${this.$route.path}`)
        .then((res) => {
          this.tableData = res.data.list
        })
    }
  }
}
